<template>
	<view>
		<view class="Do-not-disturb-messages">
			消息免打扰
		</view>
		<view class="Creative-services-box">
			<view class="Creative-services-name">
				<view class="Creative-services">
					创作服务
				</view>
				<view class="Creative-services-switch">
					<u-switch v-model="CreativeValue" @change="saveState('CreativeValue', CreativeValue)" space=0.5
						activeColor="rgb(250, 176, 176)" inactiveColor="darkgray" size="34" class="my-switch"></u-switch>
				</view>
			</view>
			<view class="event-notice-name">
				<view class="event-notice">
					活动通知
				</view>
				<view class="event-notice-switch">
					<u-switch v-model="EventValue" @change="saveState('EventValue', EventValue)" space=0.5 activeColor="rgb(250, 176, 176)"
						inactiveColor="darkgray" size="34" class="my-switch"></u-switch>
				</view>
			</view>
		</view>
		<view class="Whether-to-display-box">
			*开启后相关信息将不在消息列表展示
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"CreativeValue": this.loadState('CreativeValue') === 'true',
				"EventValue": this.loadState('EventValue') === 'true',
			}
		},
		methods: {
			CreativeServices(e) {
				console.log('CreativeServices', e);
			},
			EventNotice(e) {
				console.log('EventNotice', e);
			},
			saveState(key, value) {
				localStorage.setItem(key, value.toString());
			},
			loadState(key) {
				return localStorage.getItem(key);
			}
		}
	}
</script>

<style scoped>
	page {
		background: rgb(246, 246, 246);
	}

	.Do-not-disturb-messages {
		width: 95%;
		height: 90rpx;
		/* background-color: aqua; */
		display: flex;
		align-items: center;
		margin-left: 2.5%;
		color: rgb(162, 162, 162);
	}

	.Creative-services-box {
		width: 100%;
		background-color: rgb(252, 252, 252);
		display: flex;
		flex-wrap: wrap;
	}
    .event-notice-name,
	.Creative-services-name {
		width: 97.5%;
		height: 140rpx;
		/* background-color: antiquewhite; */
		margin-left: 2.5%;
		display: flex;
	}
    .event-notice-name{
		border-top: 1rpx solid rgba(162, 162, 162, 0.1);
	}
	.event-notice,
	.Creative-services {
		width: 78%;
		height: 100%;
		/* background-color: aquamarine; */
		line-height: 140rpx;
		font-size: 36rpx;
	}

	.event-notice-switch,
	.Creative-services-switch {
		width: 20%;
		height: 100%;
		/* background-color: aqua; */
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.my-switch:checked {
		background-color: red;
		/* 开启状态下圆点变红 */
	}
	.Whether-to-display-box{
		width: 95%;
		height: 80rpx;
		line-height: 80rpx;
		margin-left: 2.5%;
		color: rgb(162, 162, 162);
	}
</style>
